package ca.uvic.group2.api;

import ca.uvic.group2.api.exceptions.*;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.io.IOException;

public interface
AuditLog extends Remote {

    static public String RMI_NAME = "G2AuditLog";

    int getTransId() throws RemoteException;

    String restartLog() throws RemoteException, IOException;
    String dumpLog(String username) throws RemoteException, IOException;

    void userBuy(String server, int transNum, String username, String stockSymbol, double amount) throws RemoteException;
    void userCommitBuy(String server, int transNum, String username) throws RemoteException;
    void userCancelBuy(String server, int transNum, String username) throws RemoteException;
    void userSell(String server, int transNum, String username, String stockSymbol, double amount) throws RemoteException;
    void userCommitSell(String server, int transNum, String username) throws RemoteException;
    void userCancelSell(String server, int transNum, String username) throws RemoteException;
    void userAddFunds(String server, int transNum, String username, double amount) throws RemoteException;
    void userQuote(String server, int transNum, String username, String stockSymbol) throws RemoteException;
    void userNewBuyTrigger(String server, int transNum, String username, String stockSymbol, double amount) throws RemoteException;
    void userCommitBuyTrigger(String server, int transNum, String username, String stockSymbol, double price) throws RemoteException;
    void userCancelBuyTrigger(String server, int transNum, String username, String stockSymbol) throws RemoteException;
    void userNewSellTrigger(String server, int transNum, String username, String stockSymbol, int amount) throws RemoteException;
    void userCommitSellTrigger(String server, int transNum, String username, String stockSymbol, double price) throws RemoteException;
    void userCancelSellTrigger(String server, int transNum, String username, String stockSymbol) throws RemoteException;
    void userDisplaySummary(String server, int transNum, String username) throws RemoteException;
    void userDisplayLog(String server, int transNum, String username, String filename) throws RemoteException;

    void systemBuy(String server, int transNum, String username, String stockSymbol, double amount) throws RemoteException;
    void systemCommitBuy(String server, int transNum, String username) throws RemoteException;
    void systemCancelBuy(String server, int transNum, String username) throws RemoteException;
    void systemSell(String server, int transNum, String username, String stockSymbol, double amount) throws RemoteException;
    void systemCommitSell(String server, int transNum, String username) throws RemoteException;
    void systemCancelSell(String server, int transNum, String username) throws RemoteException;
    void systemAddFunds(String server, int transNum, String username, double amount) throws RemoteException;
    void systemQuote(String server, int transNum, String username, String stockSymbol) throws RemoteException;
    void systemNewBuyTrigger(String server, int transNum, String username, String stockSymbol, double amount) throws RemoteException;
    void systemCommitBuyTrigger(String server, int transNum, String username, String stockSymbol, double price) throws RemoteException;
    void systemCancelBuyTrigger(String server, int transNum, String username, String stockSymbol) throws RemoteException;
    void systemNewSellTrigger(String server, int transNum, String username, String stockSymbol, int amount) throws RemoteException;
    void systemCommitSellTrigger(String server, int transNum, String username, String stockSymbol, double price) throws RemoteException;
    void systemCancelSellTrigger(String server, int transNum, String username, String stockSymbol) throws RemoteException;
    void systemDisplaySummary(String server, int transNum, String username) throws RemoteException;
    void systemDisplayLog(String server, int transNum, String username, String filename) throws RemoteException;

    void accountAdd(String server, int transNum, String username, double funds) throws RemoteException;
    void accountRemove(String server, int transNum, String  username, double funds) throws RemoteException;

    void quote(String server, int transNum, double price, String stockSymbol, String username, long qsTimestamp, String key) throws RemoteException;

    void errorEvent(String server, int transNum, String username, String cmd, String message) throws RemoteException;
}

// Possible errors
//
// Login Failure
// Invalid Session ID
// Communication Failure
// Invalid Operation
//   Insufficient Funds
//   Commit Failure

